import { Component, Vue } from 'vue-property-decorator';

@Component
export class ShowRdata extends Vue {
    public showRdata(rdata: { status: number; message: string }, successMsg: string = '操作成功', fn?: any) {
        if (rdata.status === 0) {
            if (successMsg) {
                wx.showToast({
                    title: successMsg,
                });
            }
            if (fn) {
                fn();
            }
        } else {
            wx.showToast({
                title: rdata.message,
                icon: 'none',
            });
        }
    }
}
